package util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;

/**
 * @Author: sszheng
 * @Date: 2018/8/6 10:02
 */
public class FileUtil {
        public static String readfile(String filename){
            File file = new File(filename);
            StringBuilder result = new StringBuilder();
            try{
                BufferedReader br = new BufferedReader(new FileReader(file));//构造一个BufferedReader类来读取文件
                String s = null;
                while((s = br.readLine())!=null){//使用readLine方法，一次读一行
                    result.append(s);
                }
                br.close();
            }catch(Exception e){
                e.printStackTrace();
            }
            return result.toString();
        }
}
